<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */
return array(
    
    'router' => array(
        'routes' => array(
            'catalog' => array(
                'type' => 'segment',
                'options' => array(
                    'route' => '[/][:country][/:controller][/:action]',
                    'constraints' => array(
                        'country' => '[A-Z]{2}',
                        'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
                    ),
                    'defaults' => array(
                        'controller' => 'home',
                        'action' => 'home'
                    )
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'home' => array(
                        'type' => 'Zend\Mvc\Router\Http\Literal',
                        'options' => array(
                            'route' => '/',
                            'defaults' => array(
                                'controller' => 'home',
                                'action' => 'home'
                            )
                        )
                    ),
                    'category' => array(
                        'type' => 'segment',
                        'options' => array(
                            'route' => '/:category_alias[/page/:page]',
                            'constraints' => array(
                                'category_alias' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'page' => '[0-9]+'
                            )
                        )
                    ),
                    'product' => array(
                        'type' => 'segment',
                        'options' => array(
                            'route' => '/:product_alias',
                            'constraints' => array(
                                'product_alias' => '[a-zA-Z][a-zA-Z0-9_-]*'
                            )
                        )
                    ),
                    'basket' => array(
                        'type' => 'Zend\Mvc\Router\Http\Literal',
                        'options' => array(
                            'route' => '/'
                        )
                    )
                )
            ),
            'user' => array(
                'type' => 'segment',
                'options' => array(
                    'route' => '/[:country]/user[/:controller][/:action]',
                    'constraints' => array(
                        'country' => '[A-Z]{2}',
                        'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
                    )
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'home' => array(
                        'type' => 'Zend\Mvc\Router\Http\Literal',
                        'options' => array(
                            'route' => '/'
                        )
                    ),
                    'checkout' => array(
                		'type' => 'Zend\Mvc\Router\Http\Literal',
                		'options' => array(
            				'route' => '/'
                		)
                    )
                )
            ),
            'lfjopauth_callback' => array(
                'type' => 'Segment',
                'options' => array(
                    'route' => '/user/callback/[:provider]',
                    'constraints' => array(
                        'provider' => '[a-zA-Z][a-zA-Z0-9_-]*'
                    ),
                    'defaults' => array(
                        'controller' => 'authentication',
                        'action' => 'authenticateFromFacebookCallback'
                    )
                )
            )
        )
    ),
    'service_manager' => array(
        'factories' => array(
            'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory'
        )
    ),
    'translator' => array(
        'locale' => 'en_US',
        'translation_file_patterns' => array(
            array(
                'type' => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern' => '%s.mo'
            )
        )
    ),
    'view_manager' => array(
        'display_not_found_reason' => true,
        'display_exceptions' => true,
        'doctype' => 'HTML5',
        'not_found_template' => 'error/404',
        'exception_template' => 'error/index',
        'template_map' => array(
            'layout/catalog' => __DIR__ . '/../../Catalog/view/layout/layout.phtml',
            'layout/user' => __DIR__ . '/../../User/view/layout/layout.phtml',
            'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
            'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
            'error/404' => __DIR__ . '/../view/error/404.phtml',
            'error/index' => __DIR__ . '/../view/error/index.phtml'
        ),
        'template_path_stack' => array(
            __DIR__ . '/../view'
        )
    ),
    
    // Specify different layouts for different modules
    'module_layouts' => array(
        'Catalog' => 'layout/catalog',
        'User' => 'layout/user'
    ),
    
    // Doctrine
    'doctrine' => array(
        'driver' => array(
            'catalog_entities' => array(
                'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'paths' => array(
                    'module/Catalog/src/Catalog/Entity'
                )
            ),
            'user_entities' => array(
                'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'paths' => array(
                    'module/User/src/User/Entity'
                )
            ),
            
            'orm_default' => array(
                'drivers' => array(
                    'Catalog\Entity' => 'catalog_entities',
                    'User\Entity' => 'user_entities'
                )
            )
        )
    )
);
